(function() { window.SLConfig = {"active":true,"disabled":false,"test_mode":false,"scan_forms":true,"app_url":"https://dash.sparkloop.app","script_url":"https://js.sparkloop.app","uuid":"team_b3435e91a3","plan":"convertkit_pro","provider":"convertkit","form_selector":"form","campaigns":true,"widgets":{"referral_hubs":[{"campaign_id":"MFe9063053ad","styling":{"colors":{"primary":"#327fd2","secondary":"#e9e8e8","headers":"#080a0d"},"custom_css":"#sl-form-screen {}\r\n#sl-form-screen \u003e section {}\r\n#sl-form-screen \u003e section h2 {}","powered_by_enabled":false},"form_widget":{"cover_image":{"enabled":false,"url":"https://dash.sparkloop.app/images/placeholder-image.jpg","position":"left"},"header":"Share Physiqonomics Weekly, Earn Rewards","subheader":"Get your friends to subscribe and earn rewards. The more subscribers you refer, the bigger the rewards.","form":{"name_input":{"enabled":true,"placeholder":"Your name"},"email_input":{"placeholder":"Your email"},"button":{"label":"Join"}},"tabs":{"how_it_works":{"enabled":true,"label":"How it works","content":"Share **Newsletter Name** and Earn Rewards When Friends You Refer Subscribe:\r\n\r\n- Refer 3 friends to redeem a $5 gift card\r\n- Refer 5 friends to redeem a specially designed coffee mug\r\n- Refer 15 friends to redeem a specially designed hat\r\n\r\nQuestions? Email us at support@mywebsite.com"},"terms":{"enabled":false,"label":"Terms \u0026 Conditions","url":""}}},"hub_widget":{"header":"Share the Vitamin, Earn Rewards","subheader":"","rewards":{"enabled":true,"layout":"horizontal","list":[{"id":"reward_60c519dcc8","image":"https://dash.sparkloop.app/assets/trophy-28b4ec9e47747ae414a5b0e7b92c1b4540fae2f0624b37da7e07e707b014d715.png","name":"Access to the Vitamin Archive","description":"","referrals":2,"recurring":false}]},"sharing":{"referral_link":{"header":"Share your link","button":{"label":"Copy Link"}},"social_links":{"enabled":true,"header":"Or share with:","socials":{"twitter":{"enabled":true,"message":"I just signed up on this awesome newsletter!"},"facebook":{"enabled":true},"facebook_messenger":{"enabled":true},"email":{"enabled":true,"message":"I just signed up on this awesome newsletter!","subject":"Check this out"},"whatsapp":{"enabled":true,"message":"I just signed up on this awesome newsletter!"},"linkedin":{"enabled":false},"telegram":{"enabled":false,"message":"I just signed up on this awesome newsletter!"},"line":{"enabled":false,"message":"I just signed up on this awesome newsletter!"}}},"email_invitation":{"enabled":true,"header":"Send to friends via email","placeholder":"Comma separated emails (max 5)","button":{"label":"Send"},"confirmation_message":"The invites have been sent","email":{"subject":"Check this out","body":"Hey, I highly recommend giving [YOUR NEWSLETTER NAME] a read. It's an awesome daily email...[EXPLAIN WHY IT'S AWESOME]. Best of all, it's free, and only takes 5 minutes to read.\r\n\r\nGive it a try and subscribe using my personal invite link below:"}}},"referrals":{"confirmed":{"enabled":true,"label":"confirmed referrals"},"pending":{"enabled":true,"label":"pending referrals"},"next":{"enabled":true,"label":"referrals to next reward"}}}}],"upscribes":[{"enabled":true,"uuid":"upscribe_093b9a76b58d","selector":"form","header":"You're subscribed!","subheader":"Aadam Ali recommends...","button_label":"Subscribe to these publications","skip_link":"Maybe later","after_submission":{"behaviour":"redirect","default_redirect_url":"https://","custom_behaviour_rules":[],"thank_you_message":null},"visibility":{"installation":null,"all_pages":true,"rules":[]},"styling":{"colors":{"primary":"#d742a8"},"custom_css":"/* Upscribe main container */\n#sparkloop-upscribe {}\n\n/* Header */\n#sparkloop-upscribe form \u003e header {}\n #sparkloop-upscribe form \u003e header h2 {}\n\n/* Recommendations */\n#sparkloop-upscribe form \u003e ul {}\n#sparkloop-upscribe form \u003e ul li {}\n\n /* Recommendation's image */\n #sparkloop-upscribe form \u003e ul li label main \u003e figure {}\n\n /* Recommendation's copy */\n #sparkloop-upscribe form \u003e ul li label main \u003e div h3 {}\n #sparkloop-upscribe form \u003e ul li label main \u003e div p {}\n\n/* Footer */\n#sparkloop-upscribe form \u003e footer {}\n /* Button */\n #sparkloop-upscribe form \u003e footer .sl-button {}\n /* \"Maybe later\" link */\n #sparkloop-upscribe form \u003e footer \u003e a.sl-skip-link {}\n","powered_by_enabled":true}}],"upscribe_ref":"sparkloop-upscribe"}}; (()=>{var qi=Object.create;var Vt=Object.defineProperty;var Xi=Object.getOwnPropertyDescriptor;var Yi=Object.getOwnPropertyNames;var Zi=Object.getPrototypeOf,Ji=Object.prototype.hasOwnProperty;var Ht=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Qi=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Yi(e))!Ji.call(t,a)&&a!==r&&Vt(t,a,{get:()=>e[a],enumerable:!(n=Xi(e,a))||n.enumerable});return t};var Wt=(t,e,r)=>(r=t!=null?qi(Zi(t)):{},Qi(e||!t||!t.__esModule?Vt(r,"default",{value:t,enumerable:!0}):r,t));var hr=Ht((mr,ot)=>{(function(t,e,r){"use strict";typeof window<"u"&&typeof define=="function"&&define.amd?define(r):typeof ot<"u"&&ot.exports?ot.exports=r():e.exports?e.exports=r():e[t]=r()})("Fingerprint2",mr,function(){"use strict";typeof Array.isArray>"u"&&(Array.isArray=function(i){return Object.prototype.toString.call(i)==="[object Array]"});var t=function(i,o){i=[i[0]>>>16,i[0]&65535,i[1]>>>16,i[1]&65535],o=[o[0]>>>16,o[0]&65535,o[1]>>>16,o[1]&65535];var s=[0,0,0,0];return s[3]+=i[3]+o[3],s[2]+=s[3]>>>16,s[3]&=65535,s[2]+=i[2]+o[2],s[1]+=s[2]>>>16,s[2]&=65535,s[1]+=i[1]+o[1],s[0]+=s[1]>>>16,s[1]&=65535,s[0]+=i[0]+o[0],s[0]&=65535,[s[0]<<16|s[1],s[2]<<16|s[3]]},e=function(i,o){i=[i[0]>>>16,i[0]&65535,i[1]>>>16,i[1]&65535],o=[o[0]>>>16,o[0]&65535,o[1]>>>16,o[1]&65535];var s=[0,0,0,0];return s[3]+=i[3]*o[3],s[2]+=s[3]>>>16,s[3]&=65535,s[2]+=i[2]*o[3],s[1]+=s[2]>>>16,s[2]&=65535,s[2]+=i[3]*o[2],s[1]+=s[2]>>>16,s[2]&=65535,s[1]+=i[1]*o[3],s[0]+=s[1]>>>16,s[1]&=65535,s[1]+=i[2]*o[2],s[0]+=s[1]>>>16,s[1]&=65535,s[1]+=i[3]*o[1],s[0]+=s[1]>>>16,s[1]&=65535,s[0]+=i[0]*o[3]+i[1]*o[2]+i[2]*o[1]+i[3]*o[0],s[0]&=65535,[s[0]<<16|s[1],s[2]<<16|s[3]]},r=function(i,o){return o%=64,o===32?[i[1],i[0]]:o<32?[i[0]<>>32-o,i[1]<>>32-o]:(o-=32,[i[1]<>>32-o,i[0]<>>32-o])},n=function(i,o){return o%=64,o===0?i:o<32?[i[0]<>>32-o,i[1]<>>1]),i=e(i,[4283543511,3981806797]),i=a(i,[0,i[0]>>>1]),i=e(i,[3301882366,444984403]),i=a(i,[0,i[0]>>>1]),i},u=function(i,o){i=i||"",o=o||0;for(var s=i.length%16,l=i.length-s,p=[0,o],m=[0,o],g=[0,0],b=[0,0],x=[2277735313,289559509],P=[1291169091,658871167],v=0;v>>0).toString(16)).slice(-8)+("00000000"+(p[1]>>>0).toString(16)).slice(-8)+("00000000"+(m[0]>>>0).toString(16)).slice(-8)+("00000000"+(m[1]>>>0).toString(16)).slice(-8)},d={preprocessor:null,audio:{timeout:1e3,excludeIOS11:!0},fonts:{swfContainerId:"fingerprintjs2",swfPath:"flash/compiled/FontList.swf",userDefinedFonts:[],extendedJsFonts:!1},screen:{detectScreenOrientation:!0},plugins:{sortPluginsFor:[/palemoon/i],excludeIE:!1},extraComponents:[],excludes:{enumerateDevices:!0,pixelRatio:!0,doNotTrack:!0,fontsFlash:!0,adBlock:!0},NOT_AVAILABLE:"not available",ERROR:"error",EXCLUDED:"excluded"},f=function(i,o){if(Array.prototype.forEach&&i.forEach===Array.prototype.forEach)i.forEach(o);else if(i.length===+i.length)for(var s=0,l=i.length;sm.name?1:p.name=0?l="Windows Phone":i.indexOf("windows")>=0||i.indexOf("win16")>=0||i.indexOf("win32")>=0||i.indexOf("win64")>=0||i.indexOf("win95")>=0||i.indexOf("win98")>=0||i.indexOf("winnt")>=0||i.indexOf("wow64")>=0?l="Windows":i.indexOf("android")>=0?l="Android":i.indexOf("linux")>=0||i.indexOf("cros")>=0||i.indexOf("x11")>=0?l="Linux":i.indexOf("iphone")>=0||i.indexOf("ipad")>=0||i.indexOf("ipod")>=0||i.indexOf("crios")>=0||i.indexOf("fxios")>=0?l="iOS":i.indexOf("macintosh")>=0||i.indexOf("mac_powerpc)")>=0?l="Mac":l="Other";var p="ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0;if(p&&l!=="Windows"&&l!=="Windows Phone"&&l!=="Android"&&l!=="iOS"&&l!=="Other"&&i.indexOf("cros")===-1)return!0;if(typeof o<"u"){if(o=o.toLowerCase(),o.indexOf("win")>=0&&l!=="Windows"&&l!=="Windows Phone")return!0;if(o.indexOf("linux")>=0&&l!=="Linux"&&l!=="Android")return!0;if(o.indexOf("mac")>=0&&l!=="Mac"&&l!=="iOS")return!0;if((o.indexOf("win")===-1&&o.indexOf("linux")===-1&&o.indexOf("mac")===-1)!=(l==="Other"))return!0}if(s.indexOf("win")>=0&&l!=="Windows"&&l!=="Windows Phone")return!0;if((s.indexOf("linux")>=0||s.indexOf("android")>=0||s.indexOf("pike")>=0)&&l!=="Linux"&&l!=="Android")return!0;if((s.indexOf("mac")>=0||s.indexOf("ipad")>=0||s.indexOf("ipod")>=0||s.indexOf("iphone")>=0)&&l!=="Mac"&&l!=="iOS")return!0;if(s.indexOf("arm")>=0&&l==="Windows Phone")return!1;if(s.indexOf("pike")>=0&&i.indexOf("opera mini")>=0)return!1;var m=s.indexOf("win")<0&&s.indexOf("linux")<0&&s.indexOf("mac")<0&&s.indexOf("iphone")<0&&s.indexOf("ipad")<0&&s.indexOf("ipod")<0;return m!==(l==="Other")?!0:typeof navigator.plugins>"u"&&l!=="Windows"&&l!=="Windows Phone"},Di=function(){var i=navigator.userAgent.toLowerCase(),o=navigator.productSub,s;if(i.indexOf("edge/")>=0||i.indexOf("iemobile/")>=0)return!1;if(i.indexOf("opera mini")>=0)return!1;if(i.indexOf("firefox/")>=0?s="Firefox":i.indexOf("opera/")>=0||i.indexOf(" opr/")>=0?s="Opera":i.indexOf("chrome/")>=0?s="Chrome":i.indexOf("safari/")>=0?i.indexOf("android 1.")>=0||i.indexOf("android 2.")>=0||i.indexOf("android 3.")>=0||i.indexOf("android 4.")>=0?s="AOSP":s="Safari":i.indexOf("trident/")>=0?s="Internet Explorer":s="Other",(s==="Chrome"||s==="Safari"||s==="Opera")&&o!=="20030107")return!0;var l=eval.toString().length;if(l===37&&s!=="Safari"&&s!=="Firefox"&&s!=="Other")return!0;if(l===39&&s!=="Internet Explorer"&&s!=="Other")return!0;if(l===33&&s!=="Chrome"&&s!=="AOSP"&&s!=="Opera"&&s!=="Other")return!0;var p;try{throw"a"}catch(m){try{m.toSource(),p=!0}catch{p=!1}}return p&&s!=="Firefox"&&s!=="Other"},Ft=function(){var i=document.createElement("canvas");return!!(i.getContext&&i.getContext("2d"))},Nt=function(){if(!Ft())return!1;var i=gt(),o=!!window.WebGLRenderingContext&&!!i;return Xe(i),o},Ui=function(){return navigator.appName==="Microsoft Internet Explorer"?!0:!!(navigator.appName==="Netscape"&&/Trident/.test(navigator.userAgent))},Fi=function(){return("msWriteProfilerMark"in window)+("msLaunchUri"in navigator)+("msSaveBlob"in navigator)>=2},Ni=function(){return typeof window.swfobject<"u"},Gi=function(){return window.swfobject.hasFlashPlayerVersion("9.0.0")},$i=function(i){var o=document.createElement("div");o.setAttribute("id",i.fonts.swfContainerId),document.body.appendChild(o)},Vi=function(i,o){var s="___fp_swf_loaded";window[s]=function(g){i(g)};var l=o.fonts.swfContainerId;$i();var p={onReady:s},m={allowScriptAccess:"always",menu:"false"};window.swfobject.embedSWF(o.fonts.swfPath,l,"1","1","9.0.0",!1,p,m,{})},gt=function(){var i=document.createElement("canvas"),o=null;try{o=i.getContext("webgl")||i.getContext("experimental-webgl")}catch{}return o||(o=null),o},Xe=function(i){var o=i.getExtension("WEBGL_lose_context");o?.loseContext()},Hi=[{key:"userAgent",getData:T},{key:"webdriver",getData:R},{key:"language",getData:j},{key:"colorDepth",getData:Ke},{key:"deviceMemory",getData:ze},{key:"pixelRatio",getData:Ae},{key:"hardwareConcurrency",getData:wi},{key:"screenResolution",getData:O},{key:"availableScreenResolution",getData:X},{key:"timezoneOffset",getData:ve},{key:"timezone",getData:ye},{key:"sessionStorage",getData:$},{key:"localStorage",getData:qe},{key:"indexedDb",getData:ht},{key:"addBehavior",getData:ti},{key:"openDatabase",getData:ri},{key:"cpuClass",getData:ii},{key:"platform",getData:ni},{key:"doNotTrack",getData:ai},{key:"plugins",getData:gi},{key:"canvas",getData:oi},{key:"webgl",getData:si},{key:"webglVendorAndRenderer",getData:li},{key:"adBlock",getData:ci},{key:"hasLiedLanguages",getData:ui},{key:"hasLiedResolution",getData:di},{key:"hasLiedOs",getData:fi},{key:"hasLiedBrowser",getData:pi},{key:"touchSupport",getData:yi},{key:"fonts",getData:hi,pauseBefore:!0},{key:"fontsFlash",getData:mi,pauseBefore:!0},{key:"audio",getData:D},{key:"enumerateDevices",getData:L}],oe=function(i){throw new Error("'new Fingerprint()' is deprecated, see https://github.com/fingerprintjs/fingerprintjs#upgrade-guide-from-182-to-200")};return oe.get=function(i,o){o?i||(i={}):(o=i,i={}),w(i,d),i.components=i.extraComponents.concat(Hi);var s={data:[],addPreprocessedComponent:function(m,g){typeof i.preprocessor=="function"&&(g=i.preprocessor(m,g)),s.data.push({key:m,value:g})}},l=-1,p=function(m){if(l+=1,l>=i.components.length){o(s.data);return}var g=i.components[l];if(i.excludes[g.key]){p(!1);return}if(!m&&g.pauseBefore){l-=1,setTimeout(function(){p(!0)},1);return}try{g.getData(function(b){s.addPreprocessedComponent(g.key,b),p(!1)},i)}catch(b){s.addPreprocessedComponent(g.key,String(b)),p(!1)}};p(!1)},oe.getPromise=function(i){return new Promise(function(o,s){oe.get(i,o)})},oe.getV18=function(i,o){return o==null&&(o=i,i={}),oe.get(i,function(s){for(var l=[],p=0;p{var ln=200,Or="__lodash_hash_undefined__",cn=800,un=16,Rr=9007199254740991,Mr="[object Arguments]",dn="[object Array]",fn="[object AsyncFunction]",pn="[object Boolean]",mn="[object Date]",hn="[object Error]",Dr="[object Function]",gn="[object GeneratorFunction]",bn="[object Map]",vn="[object Number]",yn="[object Null]",Ur="[object Object]",wn="[object Proxy]",_n="[object RegExp]",Sn="[object Set]",En="[object String]",xn="[object Undefined]",Cn="[object WeakMap]",Tn="[object ArrayBuffer]",kn="[object DataView]",An="[object Float32Array]",Ln="[object Float64Array]",Bn="[object Int8Array]",Pn="[object Int16Array]",In="[object Int32Array]",On="[object Uint8Array]",Rn="[object Uint8ClampedArray]",Mn="[object Uint16Array]",Dn="[object Uint32Array]",Un=/[\\^$.*+?()[\]{}|]/g,Fn=/^\[object .+?Constructor\]$/,Nn=/^(?:0|[1-9]\d*)$/,A={};A[An]=A[Ln]=A[Bn]=A[Pn]=A[In]=A[On]=A[Rn]=A[Mn]=A[Dn]=!0;A[Mr]=A[dn]=A[Tn]=A[pn]=A[kn]=A[mn]=A[hn]=A[Dr]=A[bn]=A[vn]=A[Ur]=A[_n]=A[Sn]=A[En]=A[Cn]=!1;var Fr=typeof global=="object"&&global&&global.Object===Object&&global,Gn=typeof self=="object"&&self&&self.Object===Object&&self,We=Fr||Gn||Function("return this")(),Nr=typeof $e=="object"&&$e&&!$e.nodeType&&$e,Ve=Nr&&typeof Ce=="object"&&Ce&&!Ce.nodeType&&Ce,Gr=Ve&&Ve.exports===Nr,xt=Gr&&Fr.process,xr=function(){try{var t=Ve&&Ve.require&&Ve.require("util").types;return t||xt&&xt.binding&&xt.binding("util")}catch{}}(),Cr=xr&&xr.isTypedArray;function $r(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}function $n(t,e){for(var r=-1,n=Array(t);++r-1}function ca(t,e){var r=this.__data__,n=dt(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}ae.prototype.clear=aa;ae.prototype.delete=oa;ae.prototype.get=sa;ae.prototype.has=la;ae.prototype.set=ca;function Te(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e1?r[a-1]:void 0,u=a>2?r[2]:void 0;for(c=t.length>3&&typeof c=="function"?(a--,c):void 0,u&&Ua(r[0],r[1],u)&&(c=a<3?void 0:c,a=1),e=Object(e);++n-1&&t%1==0&&t0){if(++e>=cn)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}function ja(t){if(t!=null){try{return ut.call(t)}catch{}try{return t+""}catch{}}return""}function mt(t,e){return t===e||t!==t&&e!==e}var At=Ir(function(){return arguments}())?Ir:function(t){return je(t)&&ne.call(t,"callee")&&!Xn.call(t,"callee")},Lt=Array.isArray;function Ot(t){return t!=null&&Yr(t.length)&&!Rt(t)}function Ka(t){return je(t)&&Ot(t)}var Xr=Zn||Ja;function Rt(t){if(!ie(t))return!1;var e=ft(t);return e==Dr||e==gn||e==fn||e==wn}function Yr(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Rr}function ie(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}function je(t){return t!=null&&typeof t=="object"}function za(t){if(!je(t)||ft(t)!=Ur)return!1;var e=Hr(t);if(e===null)return!0;var r=ne.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&ut.call(r)==zn}var Zr=Cr?Vn(Cr):xa;function qa(t){return Ia(t,Jr(t))}var Xa=jr(function(t){return t.push(void 0,Kr),$r(Ya,void 0,t)});function Jr(t){return Ot(t)?wa(t,!0):Ca(t)}var Ya=Oa(function(t,e,r,n){Pt(t,e,r,n)});function Za(t){return function(){return t}}function Qr(t){return t}function Ja(){return!1}Ce.exports=Xa});var Je=(t,e,r="default")=>{let n=document.createElement("li");if(n.classList.add("sl-popup-item"),n.setAttribute("data-type",r),r!="default"){let f=document.createElement("div");f.classList.add("sl-popup-icon"),f.classList.add(`sl-popup-${r}-icon`),n.appendChild(f)}let a=document.createElement("div");a.classList.add("sl-popup-close"),n.appendChild(a),a.addEventListener("click",()=>n.remove());let c=document.createElement("div");c.classList.add("sl-popup-text-container");let u=document.createElement("h3");u.innerText=t,c.appendChild(u);let d=document.createElement("p");if(d.innerHTML=e,c.appendChild(d),n.appendChild(c),document.getElementById("sl-popup-container"))document.getElementById("sl-popup-container").appendChild(n);else{let f=document.createElement("ul");f.id="sl-popup-container",f.appendChild(n),document.getElementsByTagName("body")[0].appendChild(f)}},Le=(t,e)=>{Je(t,e,"success")},Be=(t,e)=>{Je(t,e,"warning")},yt=(t,e)=>{Je(t,e,"error")},J=(t,e)=>{Je(t,e)};function et(t){for(var e=1;e"u")){u=et({},e,u),typeof u.expires=="number"&&(u.expires=new Date(Date.now()+u.expires*864e5)),u.expires&&(u.expires=u.expires.toUTCString()),a=encodeURIComponent(a).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var d="";for(var f in u)!u[f]||(d+="; "+f,u[f]!==!0&&(d+="="+u[f].split(";")[0]));return document.cookie=a+"="+t.write(c,a)+d}}function n(a){if(!(typeof document>"u"||arguments.length&&!a)){for(var c=document.cookie?document.cookie.split("; "):[],u={},d=0;dnew URLSearchParams(window.location.search).get(t),Pe=()=>(window.location.origin+window.location.pathname).replace(/\/$/,""),Se=t=>new RegExp("^"+t.split(/\*+/).map(rn).join(".*")+"$"),rn=t=>t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&");var W=t=>{let e=new Event(`sl:${t}`);document.dispatchEvent(e)},Q=()=>!!S("SLVerifyInstall"),Ie=()=>Q()&&S("SLVerifyInstall").includes("MF"),K=()=>Q()&&S("SLVerifyInstall").includes("upscribe"),tt=()=>Q()&&S("SLVerifyInstall").includes("partner_program"),U=()=>window.SL.config.test_mode||S("test_mode")=="true",G=()=>S("debug")=="true",pe=()=>S("partner_mode")=="true",nn=()=>window.location.hostname==="referralhub.page",jt=()=>window.location.hostname==="upscribe.page",I=()=>window.SL.config||{},k=(t={})=>{let e=window.SL.visitor||{};return Object.keys(t).length&&(e=Object.assign(e,t)),window.SL.visitor=e,window.SL.visitor},B=(t=null)=>{let e=k();return t&&Object.keys(e).length&&(e.subscriber=t,W("subscriber-updated")),e.subscriber},an=()=>Q()?S("rh_ref"):k().referrer,Oe=(t=null)=>{let e=I().widgets.upscribes;return t?e.find(n=>n.uuid==t):e[0]},me=()=>{let t=k();return{uuid:I().uuid,referrer_code:an(),campaign_id:t.campaign,utm_source:t.utm_source,utm_campaign:t.utm_campaign,fingerprint:t.fingerprint,origin:t.origin,email:t.email}},_t=()=>S("flash_messages")=="true",Kt=()=>{U()&&_t()&&J("TEST MODE ENABLED","You're currently in test mode. No data will be stored while in test mode")},zt=()=>window.SLConfig.plan!="lite_v3"||U()||nn(),ee=(t,e,r=30)=>{if(Q()||U())return!1;let n=window.location.hostname.replace("www.","");e&&(H.set(t,e,{expires:r,domain:`.${n}`}),console.log(`${t} tracked`))},qt=()=>{document.documentElement.style.setProperty("--sl-widgets-font-family","-apple-system, system-ui"),document.documentElement.style.setProperty("--sl-widgets-base-unit","16px")},rt=(t,e)=>{let r=`sparkloop-${t}-custom-css`;document.getElementById(r)&&document.getElementById(r).remove();var n=document.createElement("style");n.type="text/css",n.id=r,n.textContent=e,document.head.appendChild(n)},Re=t=>{let e=`sparkloop-${t}-style`;if(document.querySelector(`link#${e}`))return;let r=document.createElement("link");r.id=e,r.setAttribute("rel","stylesheet"),r.setAttribute("href",`${window.SLConfig.app_url}/styles/${t}.css`),document.head.appendChild(r)},Me=t=>{let e=document.createElement("link");e.setAttribute("rel","preload"),e.setAttribute("as","image"),e.setAttribute("href",t),document.head.appendChild(e)},Xt=(t,e,r)=>{let n;if(document.body.createTextRange){let a=document.body.createTextRange();a.moveToElementText(t),a.select()}else if(window.getSelection&&document.createRange){t.readOnly=!1;let a=document.createRange();a.selectNodeContents(t);let c=window.getSelection();c.removeAllRanges(),c.addRange(a),(t.nodeName=="TEXTAREA"||t.nodeName=="INPUT")&&t.select(),t.setSelectionRange&&navigator.userAgent.match(/ipad|ipod|iphone/i)&&(t.setSelectionRange(0,999999),t.readOnly=!0)}try{n=document.execCommand("copy")}catch{n=!1}if(n){let a=e.textContent,c=r;e.textContent=c,setTimeout(()=>e.textContent=a,500),console.log("Referral link copied to clipboard.")}},it=t=>t.querySelector(`input[type*="email"], input[type*="Email"], input[type*="EMAIL"], input[name*="EMAIL"], input[name*="email"], input[name*="Email"], input[for*="email"], input[for*="Email"], input[for*="EMAIL"]`),Yt=t=>t.querySelector(`input[type*="submit"], input[type*="image"], button[type*="submit"], button:not([type])`),Zt=t=>{let e=!1,r=!1;return t.forEach(n=>{n.querySelector(".gform_body")&&(e=!0),it(n)&&(r=!0)}),e&&!r},St=t=>t.hasAttribute("data-sv-form"),nt=t=>t.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),C=({type:t="div",id:e="",classes:r="",text:n="",html:a="",parent:c,attributes:u={}}={})=>{let d=document.createElement(t);e&&(d.id=e),r&&(d.className=r),n&&(d.innerText=n),a&&(d.innerHTML=a),c&&c.appendChild(d);for(let f in u)d.setAttribute(f,u[f]);return d},Jt=(t,e,r="")=>{let n=`https://sparkloop.app/${r}?utm_campaign=powered-by&utm_source=${t}&utm_medium=${I().uuid}`;return C({type:"a",attributes:{href:n,target:"_blank"},text:"\u26A1\uFE0F by SparkLoop",parent:e})},Qt=()=>{let t=()=>C({html:""}),e={get:function(){return t}};return new Proxy({},e)};var F=async(t,e,r="POST",n={})=>{let a=I(),c=`${a.script_url}/${a.uuid}`,u={method:r,headers:{"Content-Type":"application/json"},keepalive:!0,...n};return r!=="GET"&&e&&(u={...u,body:JSON.stringify(e)}),await(await fetch(c+t,u)).json()},at=t=>F("/add_subscriber",t).then(e=>e),er=t=>F(`/campaigns/${t.campaign_id}/verify_script`,t).then(e=>e),tr=t=>F(`/campaigns/${t.campaign_id}/test_referral`,t).then(e=>e),rr=(t,e)=>F(`/upscribes/${t}/add_log`,e).then(r=>r),ir=t=>F(`/upscribes/${t}/verify_script`).then(e=>e),nr=t=>F(`/partner_programs/${t}/verify_script`).then(e=>e),ar=t=>F(`/upscribes/${t}/test_widget`).then(e=>e),or=t=>F(`/partner_programs/${t}/test_referral`).then(e=>e),sr=t=>F(`/partner_campaigns/${t}/partner_test`).then(e=>e),De=(t,e)=>F(`/upscribes/${t}/add_event`,e).then(r=>r);var lr=t=>F("/check_referral_code",t).then(e=>e),cr=t=>F("/check_partner_code",t).then(e=>e),ur=(t,e)=>F("/get_subscriber",{subscriber:t,...e}).then(r=>r.response==="error"?Promise.reject(r.message):Promise.resolve(r.subscriber)),dr=(t,e)=>F("/upsert_subscriber",{subscriber:t,...e}).then(r=>r.response==="error"?Promise.reject(r.message):Promise.resolve(r.subscriber)),fr=t=>F(`/campaigns/${t.campaign_id}/send_email_invite`,t).then(e=>Promise.resolve(e)).catch(()=>Promise.reject()),pr=t=>{let r=new AbortController,n=setTimeout(()=>r.abort(),2e3);return F(`/upscribes/${t}/recommendations`,null,"GET",{signal:r.signal}).then(a=>(clearTimeout(n),a)).catch(()=>(clearTimeout(n),{recommendations:[],recs_insights:[]}))};var Et=Wt(hr()),Ee="__sl",gr=`${Ee}-campaign`,br=`${Ee}-utm_campaign`,vr=`${Ee}-utm_source`,yr=`${Ee}-origin`,wr=`${Ee}-fingerprint`,_r=`${Ee}-referrer`,Ue=class{constructor(){this.config=I(),this.visitor={}}storeInfoCookies(){this.visitor.campaign&&ee(`${gr}-${this.config.uuid}`,this.visitor.campaign),this.visitor.utm_source&&ee(`${vr}-${this.config.uuid}`,this.visitor.utm_source),this.visitor.utm_campaign&&ee(`${br}-${this.config.uuid}`,this.visitor.utm_campaign),this.visitor.origin&&ee(`${yr}-${this.config.uuid}`,this.visitor.origin)}fetchCampaign(){let e=H.get(`${_r}-${this.config.uuid}`)?H.get(`${gr}-${this.config.uuid}`):S("sl_campaign");this.visitor.campaign=this.config.campaign||e||S("sl_campaign")}fetchUTMCampaign(){this.visitor.utm_campaign=this.config.utm_campaign||S("utm_campaign")||H.get(`${br}-${this.config.uuid}`)}fetchUTMSource(){let e=S("utm_source")||S("ref")||S("source"),r=H.get(`${vr}-${this.config.uuid}`),n=document.referrer&&new URL(document.referrer).hostname!=window.location.hostname?new URL(document.referrer).hostname.replace(/^www\./,""):null;this.visitor.utm_source=this.config.utm_source||e||n||r}fetchOrigin(){this.visitor.origin=this.config.origin||H.get(`${yr}-${this.config.uuid}`)}async fetchAndVerifyReferrer(){let e=`${_r}-${this.config.uuid}`,r=H.get(e);r&&(this.storeInfoCookies(),this.visitor.referrer=r);let n=S("rh_ref")||S("rh_partner");if(n){let a={uuid:this.config.uuid,referrer_code:n,campaign_id:this.visitor.campaign,utm_source:this.visitor.utm_source,utm_campaign:this.visitor.utm_campaign,fingerprint:this.visitor.fingerprint},c;try{S("rh_partner")?(c=await cr(a),console.log(`Partner Campaign Referral Code ${n} verified successfully`)):(c=await lr(a),console.log("REQ:",c),console.log(`Subscriber Referral code ${n} verified successfully`)),c.response=="ok"?(W("referrer-tracked"),ee(e,n),this.visitor.referrer=n,this.storeInfoCookies()):console.warn(c.message)}catch(u){console.error(u)}}}calculateFingerprint(){return new Promise((e,r)=>{(window.requestIdleCallback||window.setTimeout)(()=>{Et.default.get(a=>{let u=a.map(f=>f.value).map(f=>Array.isArray(f)||typeof f=="object"?JSON.stringify(f):f),d=Et.default.x64hash128(u.join(""),31);return e(d)})})})}async fetchFingerprint(){let e=H.get(wr);if(e)this.visitor.fingerprint=e;else try{let r=await this.calculateFingerprint();ee(wr,r),this.visitor.fingerprint=r}catch(r){console.error(r)}}async profile(){this.fetchCampaign(),this.fetchUTMSource(),this.fetchUTMCampaign(),this.fetchOrigin(),await this.fetchFingerprint(),await this.fetchAndVerifyReferrer(),k(this.visitor)}};var on="__sl",Sr=`${on}-subscriber`,z=class{constructor(){this.config=I()}subscriberId(){return H.get(`${Sr}-${this.config.uuid}`)||S("subscriber_id")}async fetch({subscriberId:e=null,campaign:r=null}={}){let n=U()?"fake_subscriber":e||this.subscriberId();if(!n)return Promise.reject("Subscriber ID or email not present");let a=me();r&&(a.campaign_id=r);try{let c=await ur(n,a);return this.store(c),Promise.resolve(c)}catch(c){return Promise.reject(c)}}async upsert({subscriber:e=null,campaign:r=null}={}){let n=U()?"fake_subscriber":e;if(!n)return Promise.reject();let a=me();r&&(a.campaign_id=r);try{let c=await dr(n,a);return this.store(c),Promise.resolve(c)}catch(c){return Promise.reject(c)}}store(e){B(e),ee(`${Sr}-${this.config.uuid}`,e.id),W("subscriber-loaded"),console.log("Subscriber set",{subscriber:e})}};var ce=class{constructor(){this.config=I(),this.visitor=k(),this.upscribe={},this.experiment=this.determineExperiment()}async load(e=null){if(this.fetchSettings(e),await this.fetchRecommendations(),this.upscribe){if(this.trackGenerationEvent(),this.upscribe.recommendations&&this.upscribe.recommendations.length==0){console.log("No recommendations available. Upscribe widget not loaded."),(this.shouldBeRedirected()||jt()&&this.upscribe.after_submission.redirect_url)&&(window.location.href=this.generateRedirectURL());return}this.loadStyles();let r=document.createElement("div");r.id="sl-overlay";let n=this.generateWidget({check_recommendations:!1});r.replaceChildren(n),document.body.appendChild(r),this.setupRecommendationObserver(),document.body.classList.add("sl-upscribe-open")}}generateWidget({check_recommendations:e=!0}={}){this.trackUpscribeShownEvent();let r=B(),n=r.email,a=this.upscribe,c;this.shouldBeRedirected()&&(c=this.generateRedirectURL());let u=()=>{confirm("Your Upscribe widget was successfully verified. You will be redirected back to SparkLoop soon.")&&(window.location.href=`${this.config.app_url}/upscribe/checklist?script_verified=true`)},d=C({id:"sparkloop-upscribe",classes:"sl-widget-body sl-zoomIn"}),f=()=>{d.classList.remove("sl-zoomIn");let O=document.querySelector("#sl-overlay")||d;O&&(O.addEventListener("animationend",()=>{O.remove()},{once:!0}),O.classList.add("sl-fadeOut"),document.body.classList.remove("sl-upscribe-open"))},y=C({classes:"sl-upscribe-thank-you-message",text:a.after_submission.thank_you_message,parent:d}),w=C({type:"form",attributes:{"data-sparkloop-form-ignore":!0},parent:d});U()&&d.classList.add("no-animation"),K()&&C({parent:w,classes:"sl-upscribe-verification",html:"To complete the verification, click on the submit button.
Don't worry: no data will be recorded."});let L=C({type:"input",attributes:{type:"hidden",name:"sl-hp",autocomplete:!1},parent:w,classes:"sl-hidden"}),E=C({type:"button",attributes:{type:"submit"},text:a.button_label,classes:"sl-button"});E.disabled||(E.disabled=!0,setTimeout(()=>{E.disabled=!1},1500));let D=this.experiment,T=this.visitor.utm_source,R=this.visitor.utm_campaign,j=this.visitor.fingerprint;E.addEventListener("click",async O=>{if(O.preventDefault(),L.value){f();return}let q=w.querySelectorAll('input[type="checkbox"]:checked');if(q.length>0&&r){E.disabled=!0;let X=Array.from(q).map($=>$.value),Z=a.recommendations.map($=>$.ref_code),ve={subscriber:U()?"fake_subscriber":r.id,partner_campaigns:X.join(","),experiment:D,shown_recommendations:Z.join(","),fingerprint:j},ye=a.recommendations.map($=>{let qe=X.includes($.ref_code)?"subscribed":"skipped";return{partner_campaign_id:$.uuid,type:qe}});if(K())u();else try{await rr(a.uuid,ve),De(a.uuid,{type:"subscribed_to_recommendation",recommendation_events:ye,email:n,experiment:D,utm_source:T,utm_campaign:R,fingerprint:j}),this.shouldBeRedirected()?window.location.href=c.toString():(w.style.display="none",y.classList.add("show","sl-fadeIn"),setTimeout(()=>{f()},2500))}catch($){console.log($)}finally{E.disabled=!1}}});let Ke=C({type:"header",parent:w});a.header&&C({type:"h2",text:a.header,parent:Ke}),C({type:"p",text:a.subheader,parent:Ke});let ze=C({type:"ul",parent:w});a.recommendations.forEach(O=>{let q=C({type:"li",parent:ze}),X=C({type:"label",attributes:{for:`partner_campaign_${O.ref_code}`},parent:q}),Z=C({type:"main",parent:X});C({type:"figure",attributes:{style:`background-image: url("${O.publication_logo}")`},parent:Z});let ve=C({type:"div",parent:Z});C({type:"h3",text:O.publication_name,parent:ve}),C({type:"p",text:O.description,parent:ve});let ye=C({parent:X,classes:"sl-upscribe-checkbox"}),$=C({type:"input",id:`partner_campaign_${O.ref_code}`,attributes:{type:"checkbox",name:"partner_campaigns[]",value:O.ref_code},parent:ye});$.checked=e,$.addEventListener("change",function(qe){let ht=ze.querySelectorAll('input[type="checkbox"]:checked');E.disabled=ht.length===0}),C({type:"span",parent:ye})}),a.recommendations.length===0&&C({type:"div",classes:"sl-instructions",text:"You have no recommendations.",parent:w});let Ae=C({type:"footer",parent:w});if(a.recommendations.length>0&&(Ae.appendChild(E),C({type:"a",text:a.skip_link,attributes:{href:this.shouldBeRedirected()?c.toString():"#"},classes:"sl-skip-link",parent:Ae}).addEventListener("click",q=>{if(K())q.preventDefault(),u();else{let X=a.recommendations.map(Z=>({partner_campaign_id:Z.uuid,type:"skipped"}));De(a.uuid,{type:"skipped_all_recommendations",recommendation_events:X,email:n,experiment:D,fingerprint:j}),this.shouldBeRedirected()?((document.querySelector("#sl-overlay")||d).remove(),document.body.classList.remove("sl-upscribe-open")):(q.preventDefault(),f())}})),a.styling.powered_by_enabled){let O=C({type:"p",id:"sl-hub-powered-by",parent:Ae});Jt("upscribe",O,"upscribe")}return d}setupRecommendationObserver(){let e={rootMargin:"0px 0px -135px 0px",threshold:.3},r=new IntersectionObserver((a,c)=>{a.forEach(u=>{if(u.isIntersecting){let d=u.target,f=d.querySelector('input[type="checkbox"]');f&&(f.checked=!0),c.unobserve(d)}})},e);document.querySelectorAll("#sparkloop-upscribe > form > ul > li").forEach(a=>{r.observe(a)})}trackUpscribeShownEvent(){if(U()||K())return;let e=this.upscribe.recommendations.map(r=>({type:"shown",partner_campaign_id:r.uuid}));De(this.upscribe.uuid,{type:"shown",recommendation_events:e,email:B().email,experiment:this.experiment,utm_source:this.visitor.utm_source,utm_campaign:this.visitor.utm_campaign,fingerprint:this.visitor.fingerprint})}trackGenerationEvent(){if(U()||K())return;let e=this.upscribe.recs_insights;De(this.upscribe.uuid,{type:"generated",stats:e.stats,unfilled_reasons:e.unfilled_reasons,email:B().email,fingerprint:this.visitor.fingerprint})}loadStyles(){this.upscribe.recommendations.forEach(e=>Me(e.publication_logo)),Re("upscribe"),document.documentElement.style.setProperty("--sl-widgets-upscribe-primary-color",this.upscribe.styling.colors.primary),rt("upscribe",this.upscribe.styling.custom_css)}fetchSettings(e){this.upscribe=Oe(e)}async fetchRecommendations(){let e=await pr(this.upscribe.uuid);this.upscribe={...this.upscribe,...e}}shouldBeRedirected(){let{behaviour:e,custom_behaviour_rules:r}=this.upscribe.after_submission;if(e==="redirect")return!0;if(e==="custom_behaviour"){let n=Pe(),c=r.filter(d=>d.behaviour==="redirect").some(d=>{let f=Se(d.current_url);return n.match(f)}),u=r.every(d=>{let f=Se(d.current_url);return!n.match(f)});return c||u}return!1}findRedirectURL(){let e=Pe(),{default_redirect_url:r,custom_behaviour_rules:n}=this.upscribe.after_submission,c=n.filter(u=>u.behaviour==="redirect").find(u=>{let d=Se(u.current_url);return e.match(d)});return c?(console.log(`Redirection rule found for Upscribe ${this.upscribe.uuid} on ${c.current_url}`),c.redirect_url):(console.log(`No redirection rule found for Upscribe ${this.upscribe.uuid}. Redirecting to default URL: ${r}`),r)}generateRedirectURL(){let e=new URL(this.findRedirectURL()),r=B();r.email&&e.searchParams.append("email",r.email),e.searchParams.append("ref",this.config.widgets.upscribe_ref);let n=window.location.search;return new URLSearchParams(n).forEach(function(c,u){e.searchParams.append(u,c)}),e}determineExperiment(){return null}};var ue=class{constructor(){this.config=I(),this.formId=0,this.submittedFormsIds=[]}track(){!this.config.scan_forms||(this.trackStandardForms(),document.addEventListener("pico.user.registered",e=>this.trackPicoForms(e)),document.addEventListener("om.Optin.init.submit",e=>this.trackOptinMonsterForms(e)),window.addEventListener("klaviyoForms",e=>this.trackKlaviyoForms(e)),document.addEventListener("MemberSpace.conversion",e=>this.trackMemberSpaceForms(e)),document.addEventListener("ckjs:submission:complete",e=>this.trackConvertKitForms(e)),document.addEventListener("emailoctopus:form.success",e=>this.trackEmailOctopusForms(e)),document.addEventListener("cf:form_submitted:ok",e=>this.trackClickFunnelsForms(e)),document.addEventListener("gform/postRender",e=>this.trackGravityForms(e)),this.trackElementorForms(),this.trackSquareSpaceForms(),this.trackWisepopsForms(),this.trackDynamicForms())}trackForm(e){if(!e.hasAttribute("data-sparkloop-form-ignore")&&!St(e)&&!e.hasAttribute("data-sparkloop-form-id")){this.formId++,e.dataset.sparkloopFormId=this.formId,console.log("tracking form",e);let r=e.getAttribute("action");r&&!r.includes("#")?e.addEventListener("submit",n=>this.combFormForEmail(e),{once:!0}):this.trackAjaxForm(e)}}trackStandardForms(){document.querySelectorAll(this.config.form_selector||"form").forEach(r=>{this.trackForm(r)})}trackDynamicForms(){let e=n=>{n.forEach(a=>{a.target.querySelectorAll("form").forEach(c=>{this.trackForm(c)})})};new MutationObserver(e).observe(document.body,{childList:!0,subtree:!0})}trackAjaxForm(e){let r=it(e);if(r){r.addEventListener("keydown",function(a){a.key==="Enter"&&(console.log("Tracked ajax form submission by pressing ENTER key"),this.combFormForEmail(e))},{once:!0});let n=Yt(e);n&&n.addEventListener("click",()=>{console.log("Tracked ajax form submission by clicking submit button"),this.combFormForEmail(e)},{once:!0})}}trackKlaviyoForms(e){console.log("klaviyo form submitted",e),console.log("klaviyo event type",e.detail.type);let r,n=e.detail.type;if(n=="submit"||n=="stepSubmit"){let a=document.querySelector(`.klaviyo-form-${e.detail.formId}`);a&&(r=a.querySelector("form"));let c=e.detail.metaData.$email;if(c)k({email:c.trim()});else return;n=="submit"?this.captureSubscriber({form:r}):n=="stepSubmit"&&setTimeout(this.captureSubscriber({form:r}),1e3)}}trackPicoForms(e){console.log("pico form submitted",e),console.log("pico event email",e.detail.email.trim()),k({email:e.detail.email.trim()}),this.captureSubscriber()}trackOptinMonsterForms(e){console.log("optinMonster form submitted",e),console.log("optinMonster event email",e.detail.Optin.data.fields.email.trim()),k({email:e.detail.Optin.data.fields.email.trim()}),this.captureSubscriber()}trackElementorForms(){if(window.jQuery){let e=!!jQuery.fn.on,r=n=>this.combFormForEmail(n.target);e?jQuery(document).on("submit_success",r):jQuery(document).bind("submit_success",r)}}trackMemberSpaceForms({detail:e}){console.log("memberSpace form submitted",e);let{order:r,plan:n,member:a}=e;k({email:a.email.trim()}),this.captureSubscriber()}trackSquareSpaceForms(){var e=this;typeof Y<"u"&&typeof Y.all=="function"&&Y.all("form").each(function(r){r.on("submit",function(n){let a;typeof r._node=="string"?a=document.querySelector(r._node):a=r._node,a&&!St(a)&&e.combFormForEmail(a)})})}trackConvertKitForms(e){console.log("ConvertKit form submitted",e),console.log("ConvertKit event email",e.detail.email_address.trim()),k({email:e.detail.email_address.trim()}),e.detail.recommendations&&k({upscribeBlocked:!0}),this.captureSubscriber({form:e.target})}trackEmailOctopusForms(e){console.log("emailoctopus form submitted",e),console.log("emailoctopus event detail",e.detail);let r=document.querySelector("[eo-block='form']").querySelector("form")||document.querySelector(".emailoctopus-form");if(r){let n=e.detail.contact.email_address||r.querySelector("input[type=email]").value;k({email:n.trim()}),this.captureSubscriber({form:r})}}trackClickFunnelsForms(e){console.log("clickfunnels form submitted",e),console.log("clickfunnels event detail",e.detail);let r=e.detail.contact?.email;r&&(k({email:r.trim()}),this.captureSubscriber())}trackGravityForms(e){console.log("gravity form submitted",e),console.log("gravity event detail",e.detail),gform!==void 0&&gform.utils.addAsyncFilter("gform/submission/pre_submission",async r=>{let n=gform.utils.getNode(".gfield--type-email input",r.form,!0);n&&(k({email:n.trim()}),this.captureSubscriber({form:r.form}))})}trackWisepopsForms(){window.wisepops&&wisepops("listen","after-form-submit",e=>{console.log("wisepops form submitted",e),console.log("wisepops event detail",e.detail);let r=e.target.elements.email;r&&(k({email:r.value.trim()}),this.captureSubscriber({form:e.target}))})}combFormForEmail(e){if(this.submittedFormsIds.includes(e.dataset.formId))return;let r=it(e);r&&r.value&&(W("form-submitted"),console.log("email input detected",r),this.submittedFormsIds.push(e.dataset.formId),k({email:r.value.trim()}),this.captureSubscriber({form:e}))}async captureSubscriber({form:e=null}={}){let r=me();if(!r.email){console.log("No email found in the form submission");return}if(console.log("\u2705 Form submission tracked succesfully. Email captured: "+r.email),G()&&(window.onbeforeunload=function(){return"Are you sure you want to leave?"}),Q())if(pe()){this.completePartnerVerification();return}else{if(Ie()){this.completeCampaignVerification(r);return}if(K()){this.completeUpscribeVerification(e);return}if(tt()){this.completePartnerProgramVerification();return}}try{let n=await at(r);B(n.subscriber),this.loadUpscribe(e)}catch(n){console.log(n)}}async completePartnerVerification(){G()&&console.log("DEBUG: completePartnerVerification() called");try{let e=S("SLVerifyInstall");if(e){let r=await sr(e);G()&&console.log("DEBUG: completePartnerVerification() response",r),Le("[Step 3 of 3] Referral tracking working successfully","Your test referral was successful. You can now safely recommend this publication via your partner link."),setTimeout(()=>{window.open(`${this.config.app_url}/partner_profile/partner_campaigns/${e}`)},2500)}}catch(e){console.log(e.message)}}async completeCampaignVerification(e){try{let r=S("SLVerifyInstall");e.campaign_id=r,await tr(e),Le("[Step 3 of 3] Referral tracking working successfully",`SparkLoop was able to track the referral correctly via your form. PS: If your form normally redirects to another page, don't worry. We have temporarily disabled the redirect to test the referral. \u{1F449} you'll be redirected back to SparkLoop in a few seconds...`),setTimeout(()=>{window.open(`${this.config.app_url}/campaigns/${r}/checklist/script?verified=true`,"_blank")},4e3)}catch(r){console.log(r.message)}}async completeUpscribeVerification(e){G()&&console.log("DEBUG: completeUpscribeVerification() called");try{let r=S("SLVerifyInstall");await ar(r),G()&&console.log(`DEBUG: Upscribe ID ${r}`),this.loadUpscribe(e),Le("[Step 3 of 3] Signup tracking working successfully","SparkLoop was able to track the signup correctly via your form.

PS: If your form normally redirects to another page, don't worry. We have temporarily disabled the redirect to test the referral.

\u{1F449} you'll be redirected back to SparkLoop in a few seconds...")}catch(r){console.log(r.message)}}async completePartnerProgramVerification(){G()&&console.log("DEBUG: completePartnerProgramVerification() called");try{let e=S("SLVerifyInstall");await or(e),G()&&console.log(`DEBUG: PartnerProgram ID ${testPartnerProgramReferral}`),Le("[Step 3 of 3] Signup tracking working successfully","SparkLoop was able to track the signup correctly via your form.

PS: If your form normally redirects to another page, don't worry. We have temporarily disabled the redirect to test the referral.

\u{1F449} you'll be redirected back to SparkLoop in a few seconds..."),setTimeout(()=>{window.open(`${this.config.app_url}/partner_programs/${e}/checklist?script_verified=true`,"_blank")},4e3)}catch(e){console.log(e.message)}}getUpscribeId(e){if(G()&&console.log("DEBUG: getUpscribeId() called"),G()&&console.log(`DEBUG: form ${e}`),Ie())return;let r=this.config.widgets.upscribes.find(n=>{if(!K()&&!n.enabled)return console.log(`Upscribe ${n.uuid} is not enabled`),!1;if(n.visibility.installation!="widget")return console.log(`Upscribe ${n.uuid} is not set to be displayed as a widget`),!1;if(n.visibility.all_pages)return!0;let a=Pe(),c=n.visibility.rules.find(u=>{let d=Se(u);return a.match(d)});return c?(console.log(`Upscribe ${n.uuid} is set to be displayed on ${c}`),!0):(console.log(`Can't find a matching rule for Upscribe ${n.uuid}`),!1)});return G()&&console.log(`DEBUG: upscribe ${r}`),r?e?e.dataset.sparkloopUpscribe!=="false"?r.uuid:null:r.uuid:null}async loadUpscribe(e=null){if(G()&&console.log("DEBUG: loadUpscribe() called"),SL.config.upscribeDisabled){console.log("Upscribe is disabled");return}if(pe()){console.log("Upscribe is disabled in partner mode");return}if(k().upscribeShown){console.log("Upscribe has already been shown to this visitor");return}if(k().upscribeBlocked){console.log("Upscribe has been blocked for this visitor");return}let r=this.getUpscribeId(e);G()&&console.log(`DEBUG: upscribeId ${r}`),r&&(k({upscribeShown:!0}),new ce().load(r))}};var sn={"":["",""],_:["",""],"*":["",""],"~":["",""],"\n":["
"]," ":["
"],"-":["
"]};function Er(t){return t.replace(RegExp("^"+(t.match(/^(\t| )+/)||"")[0],"gm"),"")}function Fe(t){return(t+"").replace(/"/g,""").replace(//g,">")}function re(t,e){var r,n,a,c,u,d=/((?:^|\n+)(?:\n---+|\* \*(?: \*)+)\n)|(?:^``` *(\w*)\n([\s\S]*?)\n```$)|((?:(?:^|\n+)(?:\t| {2,}).+)+\n*)|((?:(?:^|\n)([>*+-]|\d+\.)\s+.*)+)|(?:!\[([^\]]*?)\]\(([^)]+?)\))|(\[)|(\](?:\(([^)]+?)\))?)|(?:(?:^|\n+)([^\s].*)\n(-{3,}|={3,})(?:\n+|$))|(?:(?:^|\n+)(#{1,6})\s*(.+)(?:\n+|$))|(?:`([^`].*?)`)|( \n\n*|\n{2,}|__|\*\*|[_*]|~~)/gm,f=[],y="",w=e||{},L=0;function E(T){var R=sn[T[1]||""],j=f[f.length-1]==T;return R?R[1]?(j?f.pop():f.push(T),R[0|j]):R[0]:T}function D(){for(var T="";f.length;)T+=E(f[f.length-1]);return T}for(t=t.replace(/^\[(.+?)\]:\s*(.+)$/gm,function(T,R,j){return w[R.toLowerCase()]=j,""}).replace(/^\n+|\n+$/g,"");a=d.exec(t);)n=t.substring(L,a.index),L=d.lastIndex,r=a[0],n.match(/[^\\](\\\\)*\\$/)||((u=a[3]||a[4])?r='
"+Er(Fe(u).replace(/^\n+|\n+$/g,""))+"
":(u=a[6])?(u.match(/\./)&&(a[5]=a[5].replace(/^\d+/gm,"")),c=re(Er(a[5].replace(/^\s*[>*+.-]/gm,""))),u==">"?u="blockquote":(u=u.match(/\./)?"ol":"ul",c=c.replace(/^(.*)(\n|$)/gm,"
  • $1
  • ")),r="<"+u+">"+c+""):a[8]?r=''+Fe(a[7])+'':a[10]?(y=y.replace("",''),r=D()+""):a[9]?r="":a[12]||a[14]?r="<"+(u="h"+(a[14]?a[14].length:a[13]>"="?1:2))+">"+re(a[12]||a[15],w)+"":a[16]?r=""+Fe(a[16])+"":(a[17]||a[1])&&(r=E(a[17]||"--"))),y+=n,y+=r;return(y+t.substring(L)+D()).replace(/^\n+|\n+$/g,"")}var h=C,Ne=class{constructor({referral_hub:e={}}={}){this.config=I(),this.referral_hub=e}animateCSS=(e,r)=>new Promise((n,a)=>{e.classList.add(r);function c(u){u.stopPropagation(),e.classList.remove(r),n("Animation ended")}e.addEventListener("animationend",c,{once:!0})});socialSharingLink=(e,r)=>{let n;return r==="facebook"?n="https://www.facebook.com/sharer.php?u="+encodeURIComponent(this.referralLink("facebook")):r==="twitter"?n="https://twitter.com/intent/tweet?text="+encodeURIComponent(e.twitter.message+` `+this.referralLink("twitter")):r==="email"?n="mailto:?subject="+encodeURIComponent(e.email.subject)+"&body="+encodeURIComponent(e.email.message+` `+this.referralLink("email")):r==="whatsapp"?n="https://api.whatsapp.com/send?text="+encodeURIComponent(e.whatsapp.message+` `+this.referralLink("whatsapp")):r==="facebook_messenger"?n=this.messengerLink():r==="linkedin"?n="https://www.linkedin.com/shareArticle?mini=true&url="+encodeURIComponent(this.referralLink("linkedin")):r==="reddit"?n="https://www.reddit.com/submit?url="+encodeURIComponent(this.referralLink("reddit"))+"&title="+e.reddit.message:r==="telegram"?n="https://t.me/share/url?url="+encodeURIComponent(this.referralLink("telegram"))+"&text"+encodeURIComponent(e.telegram.message):r==="line"&&(n="https://line.me/R/msg/text/?"+encodeURIComponent(e.line.message+` `+this.referralLink("line"))),n};referralLink=(e=null)=>{let r=B();if(r){let n=r.referral_link;return e&&(n+=`?utm_source=${e}`),n}else return this.config.app_url+"?rh_ref=ABC123"};messengerLink=()=>{let e;return/Mobi|Android/i.test(navigator.userAgent)?e="fb-messenger://share?redirect_uri="+encodeURIComponent(this.config.default_url)+"&link="+encodeURIComponent(this.referralLink("facebook_messenger")):e="https://www.facebook.com/dialog/send?app_id=189109296592814&link="+encodeURIComponent(this.referralLink("facebook_messenger"))+"&redirect_uri="+encodeURIComponent(this.config.default_url),e};poweredByLink=(e,r,n="")=>{let a=`https://sparkloop.app/${n}?utm_campaign=powered-by&utm_source=${e}&utm_medium=${this.config.uuid}`;return h({type:"a",attributes:{href:a,target:"_blank"},text:"\u26A1\uFE0F by SparkLoop",parent:r})};formWidget=({onSubmit:e})=>{let{form_widget:r}=this.referral_hub;r.cover_image.enabled&&Me(r.cover_image.url);let n=h({id:"sl-form-screen",classes:"sl-widget-body"});if(r.cover_image.enabled){n.classList.add("sl-cover-image","sl-cover-image--"+r.cover_image.position);let T=h({type:"figure",parent:n});h({type:"img",attributes:{src:r.cover_image.url},parent:T})}let a=h({type:"section",id:"sl-form-section",classes:"sl-form-section",parent:n}),c=h({classes:"sl-form-content",parent:a});r.header&&h({type:"h2",html:re(r.header),parent:c}),r.subheader&&h({type:"p",html:re(r.subheader),parent:c});let u=h({type:"form",parent:a,attributes:{"data-sparkloop-form-ignore":!0}}),d=h({classes:"sl-form-container",parent:u});if(r.form.name_input.enabled){let T={type:"text",name:"name",placeholder:r.form.name_input.placeholder};U()||(T.required=!0),h({type:"input",attributes:T,parent:d})}let f={type:"email",name:"email",placeholder:r.form.email_input.placeholder};U()||(f.required=!0);let y=h({type:"input",attributes:f,parent:d}),w=h({type:"button",attributes:{type:"submit"},classes:"sl-button",text:r.form.button.label,parent:d});u.addEventListener("submit",T=>{T.preventDefault(),T.stopPropagation(),y.value.length>0&&(w.disabled=!0,e(y.value).catch(R=>{console.log(R),w.disabled=!1}))});let L=h({type:"footer",parent:a});r.tabs.how_it_works.enabled&&(h({type:"a",attributes:{href:"#"},text:r.tabs.how_it_works.label,parent:L}).addEventListener("click",R=>{R.preventDefault(),R.stopPropagation(),this.animateCSS(a,"sl-fadeOutLeft").then(j=>{a.style.display="none",E.style.display="flex"})}),h({type:"span",text:"|",parent:L})),r.tabs.terms.enabled&&(h({type:"a",attributes:{href:r.tabs.terms.url},text:r.tabs.terms.label,parent:L}),h({type:"span",text:"|",parent:L})),this.referral_hub.styling.powered_by_enabled&&this.poweredByLink("referral-hub",L);let E=h({type:"section",id:"sl-how-it-works-section",classes:"sl-section-large",parent:n});return E.style.display="none",h({type:"a",classes:"sl-back-button",html:` Back `,attributes:{href:"#"},parent:E}).addEventListener("click",T=>{T.preventDefault(),T.stopPropagation(),this.animateCSS(E,"sl-fadeOutRight").then(R=>{a.style.display="flex",E.style.display="none"})}),h({type:"h2",text:r.tabs.how_it_works.label,parent:E}),h({type:"article",html:re(r.tabs.how_it_works.content),parent:E}),n};rewardsElement=()=>{let e=B();if(!e)return;let{hub_widget:r}=this.referral_hub,n=r.rewards.list,a=r.rewards.layout,c=h({type:"ul",id:"sl-rewards-section"});return c.classList.add(`sl-rewards-layout-${a}`),n.forEach((u,d)=>{d++;let f=e.rewards_won.includes(u.id),y=h({type:"li",classes:"sl-reward",parent:c});f&&y.classList.add("sl-reward-won");let w=h({type:"figure",classes:"sl-reward-image",parent:y});w.style.backgroundImage='url("'+u.image+'")';let L=h({classes:"sl-reward-referrals",parent:w});h(f?{type:"span",parent:L,html:` `}:{type:"span",text:u.referrals,parent:L});let E=h({classes:"sl-reward-info",parent:y});if(h({type:"h4",text:u.name,parent:E}),u.description)if(a=="horizontal"){let D=h({classes:"sl-reward-description hide",parent:w});h({type:"p",text:u.description,parent:D}),h({type:"span",parent:E,html:` `}).addEventListener("click",function(R){D.classList.toggle("hide")})}else h({type:"p",text:u.description,parent:E});n.length<6||d==1||d==n.length||(n.length%5==0?d%5==0&&(y.classList.add("sl-before-break"),h({type:"span",classes:"sl-reward-break",parent:c})):n.length%4==0?d%4==0&&(y.classList.add("sl-before-break"),h({type:"span",classes:"sl-reward-break",parent:c})):n.length%3==0?d%3==0&&(y.classList.add("sl-before-break"),h({type:"span",classes:"sl-reward-break",parent:c})):d%4==0&&(y.classList.add("sl-before-break"),h({type:"span",classes:"sl-reward-break",parent:c})))}),c};sharingElement=()=>{if(!B())return;let{hub_widget:r}=this.referral_hub,n=h({type:"section",id:"sl-sharing-section"}),a=h({id:"sl-sharinglink-container",parent:n});if(h({type:"p",text:r.sharing.referral_link.header,parent:a}),a.appendChild(this.referralLinkElement()),r.sharing.social_links.enabled){let c=h({id:"sl-sociallinks-container",parent:n});h({type:"p",text:r.sharing.social_links.header,parent:c}),c.appendChild(this.socialIconsElement())}if(r.sharing.email_invitation.enabled){let c=h({id:"sl-emailinvitation-container",parent:n});h({type:"p",text:r.sharing.email_invitation.header,parent:c});let u=h({type:"span"});c.appendChild(this.emailInvitationElement(u)),c.appendChild(u)}return n};referralLinkElement=()=>{let e=B();if(!e)return;let{sharing:r}=this.referral_hub.hub_widget,n=h({type:"form",attributes:{"data-sparkloop-form-ignore":!0}}),a=h({type:"input",parent:n,attributes:{type:"text",readonly:!0,value:e.referral_link}}),c=h({type:"button",classes:"sl-button",parent:n,text:r.referral_link.button.label});return c.addEventListener("click",u=>{u.preventDefault(),Xt(a,c,r.referral_link.button.label)}),n};statsElement=()=>{let e=B();if(!e)return;let{referrals:r}=this.referral_hub.hub_widget,n=h({type:"section",id:"sl-referrals-section"});if(r.confirmed.enabled){let a=h({id:"sl-confirmed-referrals",parent:n});h({type:"h3",text:nt(e.referrals.confirmed),parent:a}),h({type:"span",text:r.confirmed.label,parent:a})}if(r.pending.enabled){let a=h({id:"sl-pending-referrals",parent:n});h({type:"h3",text:nt(e.referrals.pending),parent:a}),h({type:"span",text:r.pending.label,parent:a})}if(r.next.enabled){let a=h({id:"sl-next-referrals",parent:n});h({type:"h3",text:nt(e.next_reward),parent:a}),h({type:"span",text:r.next.label,parent:a})}return n};socialIconsElement=()=>{if(!B())return;let{hub_widget:r}=this.referral_hub,n=h({id:"sl-sociallinks-icons"});return["twitter","facebook","email","whatsapp","linkedin","telegram"].forEach(c=>{if(r.sharing.social_links.socials[c].enabled){let u=h({type:"a",classes:"sl-social",id:`sl-social-${c}`,attributes:{title:`Share on ${c}`,href:this.socialSharingLink(r.sharing.social_links.socials,c)}});u.style.backgroundImage="url(https://sparkloop-static-images.s3-us-west-1.amazonaws.com/"+c+".png)",n.appendChild(u)}}),n};emailInvitationElement=e=>{let r=B();if(!r)return;let{email_invitation:n}=this.referral_hub.hub_widget.sharing,a=h({type:"form",attributes:{"data-sparkloop-form-ignore":!0}}),c=h({type:"input",parent:a,classes:"sl-widget-input",attributes:{type:"text",placeholder:n.placeholder}}),u=h({type:"button",classes:"sl-button",parent:a,text:n.button.label});return u.addEventListener("click",async d=>{d.preventDefault(),d.stopPropagation(),u.disabled=!0,e.innerText="";let f=c.value.trim();if(f.length>0){let y={campaign_id:this.referral_hub.campaign_id,subscriber:r.id,recipients:f};try{await fr(y),c.value="",e.innerText=n.confirmation_message}catch{e.innerText="Server error. Please try again."}finally{u.disabled=!1}}}),a};hubWidget=()=>{if(!B())return;let{hub_widget:r}=this.referral_hub;r.rewards.list.forEach(c=>{Me(c.image)});let n=h({id:"sl-hub-screen",classes:"sl-widget-body"});if(r.header&&r.header.trim().length>0||r.subheader&&r.subheader.trim().length>0){let c=h({type:"header",parent:n});r.header&&r.header.trim().length>0&&h({type:"h2",html:re(r.header),parent:c}),r.subheader&&r.subheader.trim().length>0&&h({type:"p",html:re(r.subheader),parent:c})}r.rewards.enabled&&r.rewards.list.length>0&&n.appendChild(this.rewardsElement());let a=h({type:"main",id:"sl-hub-main",parent:n});if(a.appendChild(this.sharingElement()),(r.referrals.confirmed.enabled||r.referrals.pending.enabled||r.referrals.next.enabled)&&a.appendChild(this.statsElement()),this.referral_hub.styling.powered_by_enabled){let c=h({id:"sl-hub-powered-by",parent:n});this.poweredByLink("referral-hub",c)}return n}};var xe=class{constructor(){this.config=I(),this.referral_hub={}}async load(){if(this.loadDefaultStyles(),this.config.widgets.referral_hubs.length&&(this.fetchReferralHubSettings(),Object.keys(this.referral_hub).length)){try{await new z().fetch({campaign:this.referral_hub.campaign_id})}catch{console.error("Subscriber was not found")}U()&&_t()&&J("Referral Hub Preview",'To visualize the hub widget, signup using any name
    and "test@test.com" as email address.
    When test mode is enabled no email will be recorded.'),this.loadReferralHubStyles(),this.loadReferralHubWidget(),this.generateReferralHubElements()}}components(){return zt()?new Ne({referral_hub:this.referral_hub}):Qt()}fetchReferralHubSettings(e){let r=this.config.widgets.referral_hubs;if(e)this.referral_hub=r.find(n=>n.campaign_id==e);else{let n=document.querySelector("#sparkloop-referral-hub")||document.querySelector("[class*=sparkloop-][data-campaign-id]");if(n){let a=n.dataset.campaignId;this.referral_hub=a?r.find(c=>c.campaign_id==a):r[0]}}}loadReferralHubWidget(){let e=document.querySelector("#sparkloop-referral-hub");!e||(B()?e.replaceChildren(this.generateHubWidget()):e.replaceChildren(this.generateFormWidget()))}generateFormWidget(){return this.components().formWidget({onSubmit:e=>this.validateAndHydrateSubscriber(e)})}generateHubWidget(){return this.components().hubWidget()}generateRewardsElement(){return this.components().rewardsElement()}generateSharingElement(){return this.components().sharingElement()}generateStatsElement(){return this.components().statsElement()}generateReferralHubElements(){if(B()){let e=(r,n)=>{let a=document.createElement("div");a.className="sl-widget-body sl-referral-hub-element",a.appendChild(n),r.replaceChildren(a)};document.querySelectorAll(`.sparkloop-rewards-element[data-campaign-id=${this.referral_hub.campaign_id}]`).forEach(r=>{e(r,this.generateRewardsElement())}),document.querySelectorAll(`.sparkloop-sharing-element[data-campaign-id=${this.referral_hub.campaign_id}]`).forEach(r=>{e(r,this.generateSharingElement())}),document.querySelectorAll(`.sparkloop-stats-element[data-campaign-id=${this.referral_hub.campaign_id}]`).forEach(r=>{e(r,this.generateStatsElement())})}}async validateAndHydrateSubscriber(e){try{await new z().upsert({subscriber:e,campaign:this.referral_hub.campaign_id}),this.loadReferralHubWidget(),this.generateReferralHubElements()}catch(r){W("subscriber-not-loaded"),console.log(`Subscriber not loaded ${r}`)}}loadDefaultStyles(){qt(),Re("default")}loadReferralHubStyles(){Re("referral_hub"),document.documentElement.style.setProperty("--sl-widgets-referral-hub-primary-color",this.referral_hub.styling.colors.primary),document.documentElement.style.setProperty("--sl-widgets-referral-hub-secondary-color",this.referral_hub.styling.colors.secondary),document.documentElement.style.setProperty("--sl-widgets-referral-hub-headers-color",this.referral_hub.styling.colors.headers),rt("referral_hub",this.referral_hub.styling.custom_css)}};var Ge=class{constructor(){this.config=I(),this.signup_email="signup@sparkloop.co"}timeoutTime(){return S("timeout")?parseInt(S("timeout")):15e3}async run(){if(Q()){let e;if(pe())J("[Step 1 of 3] Referral testing process initiated","\u23F1 checking for a valid signup form on the page"),this.verifyReferralTracking();else try{let r=S("SLVerifyInstall");if(Ie())e=await er({campaign_id:r});else if(K()){if(console.log("upscribe settings",Oe(r)),Oe(r)==null)throw"Upscribe settings not found";e=await ir(r)}else tt()&&(e=await nr(r));console.log("script verified successfully",e),J("[Step 1 of 3] Script found on page","Your SparkLoop tracking script is correctly installed on this page.

    \u{1F449} let's make sure SparkLoop can identify your email signup form(s)."),this.verifyReferralTracking()}catch(r){console.error("script verification failed",r),yt("Script verification failed","Please reload the page and try again.")}}}fetchForms(){return document.querySelectorAll(this.config.form_selector||"form")}verifyReferralTracking(){setTimeout(()=>{this.fetchForms().length?this.verifyForm():Zt(this.fetchForms())?Be("Gravity form detected","SparkLoop has detected a broken Gravity form on this page.
    See instructions on how to fix it"):(Be("We can't detect a valid form on this page","SparkLoop will try for another 15 seconds.

    \u{1F449} if the form is inside a popup, try opening it (make the form appear on the page)"),setTimeout(()=>{this.fetchForms().length?this.verifyForm():yt("Bad news \u{1F61E}",`SparkLoop couldn't detect a valid form on this page. If you get this error but the form is visible on the page, it's possible that the form is inside an iFrame or otherwise incompatible with our SparkLoop tracking script. \u{1F449} contact our support team (support@sparkloop.app) to find a solution.`)},this.timeoutTime()))},1500)}verifyForm(){pe()?J("[Step 2 of 3] Make a test referral",`\u{1F449} Subscribe to this publication via the opt-in form on the page, using the email address ${this.signup_email}

    Then wait up to 10 seconds for a success message to be shown.`):J("[Step 2 of 3] Valid form found",`SparkLoop has detected a valid email signup form on this page. Now we need to check that our tracking script can track signups correctly via your form.

    \u{1F449} fill out and submit your form using the email address ${this.signup_email}`),new ue().track(),setTimeout(()=>{window.SL.visitor.email||(pe()?Be("Signup not yet detected",`We haven't been able to detect a valid referral yet.

    If you haven't already followed the instructions in Step #2 (above), do so now.

    If you have already subscribed with ${this.signup_email} and are seeing this message, it means referral tracking is broken for this publication. You should contact us via support@sparkloop.app and do not recommend this publication until the issue has been fixed.`):Be("Signup not yet detected",`SparkLoop hasn't been able to detect a valid signup yet. \u{1F449} if you haven't submitted the form yet using ${this.signup_email}, please do so now. If you have submitted the email signup form correctly, it's likely there's an error in the form which prevents us from tracking referrals correctly. In this case, please contact our support team (support@sparkloop.app) and we'll help you find an easy solution!`))},this.timeoutTime())}};var Dt=Wt(ei());var Mt=class{constructor(e){this.config=e}widgets(e){let r=new xe;return r.fetchReferralHubSettings(e),r.loadReferralHubStyles(),r}async upscribe(e,r){try{await new z().fetch({subscriberId:r.trim()});let a=new ce;return a.fetchSettings(e),a.upscribe.recommendations||await a.fetchRecommendations(),a.loadStyles(),a.generateWidget()}catch(n){console.error(n)}}async upscribePopup(e,r){try{k({email:r.trim()});let n=await at(me());B(n.subscriber),new ce().load(e)}catch(n){console.error(n)}}generate={rewardsElement:e=>this.widgets(e).generateRewardsElement(),sharingElement:e=>this.widgets(e).generateSharingElement(),statsElement:e=>this.widgets(e).generateStatsElement(),formWidget:e=>this.widgets(e).generateFormWidget(),hubWidget:e=>this.widgets(e).generateHubWidget(),upscribeWidget:(e,r)=>this.upscribe(e,r),upscribePopup:(e,r)=>this.upscribePopup(e,r)};reset(e){this.config=(0,Dt.default)(e,window.SLConfig)}trackSubscriber(e){e?(k({email:e.trim()}),new ue().captureSubscriber()):console.error("Email can't be blank.")}async getSubscriber(e,r=null){try{let a=await new z().fetch({subscriberId:e.trim(),campaign:r});return Promise.resolve(a)}catch(n){return console.log(n),Promise.reject(n)}}async run(){W("ready"),G()&&console.log("DEBUG MODE IS ON"),Kt(),await new Ue().profile(),new Ge().run(),new ue().track();try{await new z().fetch()}catch(c){W("subscriber-not-loaded"),console.log(c)}new xe().load()}},Qa=(t,e=null)=>{if(!t.active)return console.warn("Sparkloop is disabled because the account is not active."),!1;let r=(0,Dt.default)(e||window.SL||{},t);if(window.SLConfig=t,r.disabled)return console.warn("SparkLoop has been manually disabled."),!1;r.test_mode&&console.warn("SparkLoop is running in test mode."),console.log("\u{1F64C} SparkLoop is loaded, time to rock'n'roll!"),console.log("Looking to grow your newsletter? Check out https://sparkloop.app/console");let n=new Mt(r);window.SL=n,n.run()};{let t=()=>{setTimeout(()=>{Qa(window.SLConfig)},window.sparkloop_delay||800)};document.readyState!=="loading"?t():(document.addEventListener("DOMContentLoaded",()=>t()),document.addEventListener("turbo:load",()=>t()))}})(); /*! js-cookie v3.0.1 | MIT */ })();